package com.itheima.controller;

import com.itheima.domain.User;
import com.itheima.exception.BusinessException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/req")
    @ResponseBody
    public String regis(Integer age){
        if (age<18  || age > 100){
            throw new BusinessException("年龄必须是18~100之间");
        }

        return "登录成功";
    }
}
